package com.example.myapplication.ApiServices;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * @author sjh
 * @Description
 * @create 2022/3/8 10:11
 */
public interface HttpBinApiService {

    @POST("post")
    @FormUrlEncoded
    Call<ResponseBody> post(@Field("username") String username, @Field("password") String password);

    @GET("get")
    Call<ResponseBody> get(@Query("username") String username, @Query("password") String password);

    @POST("post")
    Call<ResponseBody> postBody(@Body RequestBody requestBody);

    @POST("post/{value}")
    Call<ResponseBody> postPath(@Path("value") String path, @Header("os") String os);

    @POST("post")
    @Headers({"os:android","version:1.0"})
    @FormUrlEncoded
    Call<ResponseBody> postHeaders(@Field("username") String username);

    @POST
    Call<ResponseBody> postUrl(@Url String url);

}
